<?php

use yii\helpers\Inflector;
use yii\helpers\StringHelper;

/* @var $this yii\web\View */
/* @var $generator yii\gii\generators\crud\Generator */

$baseName = Inflector::camel2id(StringHelper::basename($generator->modelClass));

echo "<?php\n";
?>

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model <?= ltrim($generator->searchModelClass, '\\') ?> */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="<?= $baseName ?>-search">

    <?= "<?php " ?>$form = ActiveForm::begin([
			'action' => ['index'],
			'method' => 'get',
			'fieldClass' => 'yak\layui\widgets\form\SearchActiveField',
			'options' => [
				'class' => 'layui-form layui-form-pane yak-form-search',
				'lay-filter' => '<?= $baseName ?>-search'
			],
			'enableClientScript' => false
		]); ?>

    <div class="layui-form-group layui-form-item">

        <?php
        $count = 0;
        foreach ($generator->getColumnNames() as $attribute) {
            if (++$count < 6) {
                echo "    <?= " . $generator->generateActiveSearchField($attribute) . " ?>\n\n";
            } else {
                echo "    <?php // echo " . $generator->generateActiveSearchField($attribute) . " ?>\n\n";
            }
        }
        ?>

        <div class="layui-inline">
            <?= "<?= " ?>Html::submitButton('<i class="layui-icon layui-icon-search"></i> 查询', ['class' => 'layui-btn layui-btn-normal yak-search-btn', 'lay-submit' => true]) ?>
        </div>

    </div>

    <?= "<?php " ?>ActiveForm::end(); ?>

</div>
